<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>跑客提现账号绑定</title>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/hui/Hui.css" />
</head>
<body>
<div class="H-padding-vertical-bottom-20"></div>
<div class="H-flexbox-horizontal H-border-vertical-bottom-after H-border-vertical-top-after">
    <!--手机号图标-->
    <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white"><i class="H-iconfont H-icon-phone H-font-size-28 H-vertical-middle H-font-size-20 H-vertical-middle H-theme-font-color-666"></i></span>
    <!--手机号图标-->
    <input id="tel" type="tel" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-14 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-15" placeholder="请输入跑客手机账号">
</div>
<div class="H-flexbox-horizontal H-border-vertical-bottom-after">
    <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white"><i class="H-iconfont H-icon-log H-font-size-28 H-vertical-middle H-font-size-20 H-vertical-middle H-theme-font-color-666"></i></span>
    <input id="code" type="tel" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-14 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-15" placeholder="请输入验证码">
    <span onclick="getVerify()" id="sendVerify" class="H-vertical-middle H-padding-horizontal-right-10 H-theme-background-color-white H-theme-font-color2 H-font-size-14">获取验证码</span>
</div>
<input type="hidden" id="weixin_code" value="{:I('get.code')}" />
<div class="H-padding-10">
    <button onclick="login_btn()" id="login" class="H-button H-width-100-percent H-theme-background-color7 H-font-size-16 H-outline-none H-padding-vertical-both-8 H-padding-horizontal-both-20 b_header_bg H-theme-font-color-white H-theme-border-color7 H-theme-border-color7-click H-theme-background-color7-click H-theme-font-color7-click H-border-radius-3">
        绑定
    </button>
</div>
</body>
<script src="//cdn.bootcss.com/zepto/1.2.0/zepto.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/test/js/layer.js"></script>
<script type="text/javascript">
	$(function(){
	 layer.open({
		content: '1、请输入您注册跑客时候注册的手机号并且验证<br />2、验证成功之后，我们将给您绑定提款账号到此微信账号钱包余额'
		,btn: '好的，我知道了'
	  });
	});
    var is_send_smsVerify = false; //是否已经发送过验证码
    //时间递减处理
    function CountDown() {
        if (time < 1) {
            var sendVerify = document.getElementById('sendVerify');
            $('#sendVerify').attr('onclick', 'getVerify()');
            $('#sendVerify').html('重新获取');
            //还原标识
            is_send_smsVerify = false;
            clearInterval(isinerval);
            return;
        }
        var getVerify = document.getElementById('getVerify');
        $('#getVerify').html('' + time + '');
        time--;
    }
    //点击获取验证码
    function getVerify() {
        //如果已经发送过验证码
        if (is_send_smsVerify) {
			  layer.open({
				content: '抱歉，已为您的手机号发送过验证码'
				,skin: 'msg'
				,time: 2 //2秒后自动关闭
			  });
            //未发送过验证吗
        } else {
            var tel = $("#tel").val();
            // 手机号的正则
            var a = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0-9]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/;
            // 判断手机号
            if (tel.length != 11 || !tel.match(a)) {
                // 如果不是正确的手机号
                 layer.open({
					content: '抱歉，手机号为空或格式错误！'
					,skin: 'msg'
					,time: 2 //2秒后自动关闭
				  });
                //alert("");
            } else {
                layer.open({
                    type : 2,
                    content : '获取中'
                });
                var data1 = "phone="+tel;
                $.getJSON("{:U('getSMS')}",data1, function(data){
					if(data){
						layer.closeAll();
						switch(data.retCode){
							case 200:
								is_send_smsVerify = true;
                                $('#sendVerify').html('<span id="getVerify">120</span>s');
                                time = 119;
                                isinerval = setInterval("CountDown()", 1000);
								layer.open({
									content: data.retDesc
									,skin: 'msg'
									,time: 2 //2秒后自动关闭
								  });
                                break;
							break;
							default:
								layer.open({
									content: data.retDesc
									,skin: 'msg'
									,time: 2 //2秒后自动关闭
								 });
							break;
						}
					}else{
					
					}
                    
					
                    //alert(JSON.stringify(data));
                });
           
            }
        }
    }
	
	function login_btn(){
		var tel = $("#tel").val();
		var code = $("#code").val();
		if(tel && code){
			window.location.href="http://app.vcool.top/index.php/Weixin/WeixinDevelopment/weixinVerification?code="+$("#weixin_code").val()+"&validate_code="+code+"&phone="+tel;
		}else{
			layer.open({
				content: "手机号和验证码必填"
				,skin: 'msg'
				,time: 2 //2秒后自动关闭
			});
		}
		
	}
</script>
</html>